package com.itheima.controller;

import com.itheima.manager.AdminLoginManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


public class AdminLoginController {

    @Autowired
    private AdminLoginManager adminLoginManager;

    //后台账号登录
    @PostMapping("/usernamelogin")
    public void adminLogin(HttpServletRequest request, HttpServletResponse response) throws IOException {
        //取出请求体中的   账号----密码
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        //调用manager查询账号密码是否存在
        adminLoginManager.adminLogin(username, password, response);
    }

}
